package com.zpark.controller;

import com.zpark.pojo.Ranking;
import com.zpark.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RankingController {
    @Autowired
    private IRankingService rankingService;


    @RequestMapping("/all")
    public List<Ranking> selectAll(){
        return rankingService.findAll();
    }


    @RequestMapping("/delete/{id}")
    public Integer delete(Integer id){
        return rankingService.remove(id);
    }


    @RequestMapping("/update")
    public Integer updateRanking(Ranking ranking){
        return rankingService.change(ranking);
    }


    @RequestMapping("/add")
    public Integer addRanking(Ranking ranking){
        return rankingService.add(ranking);
    }

}
